package com.tju320.elm;

import java.util.Scanner;

import com.tju320.elm.po.Admin;
import com.tju320.elm.view.AdminView;
import com.tju320.elm.view.BusinessView;
import com.tju320.elm.view.impl.AdminViewImpl;
import com.tju320.elm.view.impl.BusinessViewImpl;

public class ElmAdminEntry {
	Scanner keyboardInput = new Scanner(System.in);

	private void work() {
		System.out.println("饿了么管理后台");
		int menu = 0;
		AdminView adview = new AdminViewImpl();
		Admin admin = adview.login();
		while(admin==null) {
			System.out.println("不存在此用户或密码错误,请再次输入");
			admin = adview.login();
		}
		BusinessView bv=new BusinessViewImpl();
		while (menu != 5) {
			System.out.println("1.所有商家列表2.搜索商家3.新建商家4.删除商家5.退出系统");
			System.out.println("请输入你的选择:");
			menu = keyboardInput.nextInt();
			switch (menu) {
			// 列出所有商家
			case 1:
				bv.listBusinessAll();
				break;
			case 2:
				bv.listBusiness();
				// 搜索商家
				break;
			case 3:
				bv.saveBusiness();
				// 新建商家
				break;
			case 4:
				bv.removeBusiness();
				// 删除商家
				break;
			case 5:
				System.out.println("欢迎你下次使用本系统");
				// 退出系统
				break;
			default:
				System.out.println("没有这个选项！");
					
			}

		}

	}

	public static void main(String[] args) {
		new ElmAdminEntry().work();
	}

}
